home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1992 February / 1992-02.d64 / rpg codebuster (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  176 lines

  1. 5 rem copyright 1992 - compute publications intl ltd - all rights reserved
  2. 10 dim by$(15),cm$(15)
  3. 20 pt$=" abcdefghijklmnopqrstuvwxyz0123456789'-#"
  4. 30 as$="204142434445464748494a4b4c4d4e4f505152535455565758595a"
  5. 40 sc$="30313233343536373839272d23":as$=as$+sc$
  6. 50 hx$="0123456789abcdef"
  7. 60 print"insert character disk, press a key..."
  8. 70 geta$:ifa$=""then goto 70
  9. 80 open 15,8,15,"i"+"0"
  10. 90 open 2,8,2,"#"
  11. 100 print"rpg codebuster":print"run/stop to quit. options:"
  12. 110 print:print:print"(1) convert character stat to hex"
  13. 120 print:print:print"(2) convert name to probable bytes"
  14. 130 print:print:print"(3) find character disk block"
  15. 140 geta$:if a$="1" or a$="2" then goto 160
  16. 150 if a$<>"3" then goto140
  17. 160 if a$="1" then gosub 1320
  18. 170 if a$="1" then goto 100
  19. 180 if a$="2" then goto 330
  20. 190 print"choose method a,b or c:"
  21. 200 print:print:print"(a) left justified character trap"
  22. 210 print:print:print"(b) running (embedded) character trap"
  23. 220 print:print:print"(c) party initial trap"
  24. 230 geta$:if(a$<>"a"anda$<>"b")and a$<>"c" then goto230
  25. 240 fl=1:if a$="b" then fl=0
  26. 250 if a$="c" then fl=3:l1$="":l2$="":l3$="":i$=""
  27. 260 sf=0:print:print:print"change sector range default (y or n)?"
  28. 270 geta$:ifa$<>"y" and a$<>"n" then goto270
  29. 280 if a$="y" then sf=1
  30. 290 if fl<>3 then goto330
  31. 300 print"type party first initials"
  32. 310 input"in order, no spaces";rp$
  33. 320 goto340
  34. 330 input"type your character's name, then return";rp$
  35. 340 forj=1to15
  36. 350 h$=mid$(rp$,j,1):fort=1to40:if h$=mid$(pt$,t,1) then i=2*t-1:t=41
  37. 360 next
  38. 370 cm$(j)=mid$(as$,i,2)
  39. 380 if cm$(j)="20" then goto410
  40. 390 if mid$(cm$(j),1,1)="3" and a$<>"2" then cm$(j)="5"+mid$(cm$(j),2,1)
  41. 400 if mid$(cm$(j),1,1)="2" and a$<>"2" then cm$(j)="4"+mid$(cm$(j),2,1)
  42. 410 if fl=3 then i$=i$+cm$(j)
  43. 420 ifj=len(rp$)then j=16
  44. 430 next
  45. 440 if a$<>"2" then goto510
  46. 450 by$=""
  47. 460 fork=1tolen(rp$)
  48. 470 by$=by$+cm$(k):by$=by$+" ":next
  49. 480 print"probable disk bytes for name:"
  50. 490 print" ";by$
  51. 500 goto100
  52. 510 print"possible hot tracks - 27-30,17-20"
  53. 520 input"which starting track";t
  54. 530 input"which ending track";et
  55. 540 if t<1 or t>35 then goto520
  56. 550 if et<1 or et>35 then goto520
  57. 560 if t>et then goto520
  58. 570 print"this takes a while -- "
  59. 580 print"current track and sector"
  60. 590 print"    being examined:"
  61. 600 s=0
  62. 610 print#15,"u1:2,"0;t;s
  63. 620 print#15,"b-p:2,1"
  64. 630 print#15,"m-r"chr$(0)chr$(5)
  65. 640 get#15,by$(0):if by$(0)="" then by$(0)=chr$(0)
  66. 650 f=1
  67. 660 print"       ";t;s
  68. 670 forc=0to8
  69. 680 ford=fto15
  70. 690 get#2,by$(d)
  71. 700 if by$(d)="" then by$(d)=chr$(0)
  72. 710 next d:f=0
  73. 720 nm=1
  74. 730 if c=0 or c=1 then goto 750
  75. 740 if c<>8 then nm=0:goto1090
  76. 750 by$=""
  77. 760 ford=0to15
  78. 770 bn=asc(by$(d))
  79. 780 n1=int(bn/16)
  80. 790 b1$=mid$(hx$,n1+1,1)
  81. 800 n2=int(bn-16*n1)
  82. 810 b2$=mid$(hx$,n2+1,1)
  83. 820 fork=2to18step2
  84. 830 if b1$=mid$(hx$,k,1) then b1$="5"
  85. 840 next
  86. 850 if b1$<>"5" then b1$="4"
  87. 860 by$=b1$+b2$
  88. 870 if by$="40" then by$="20"
  89. 880 if fl=0 then goto920
  90. 890 if cm$(d+1)<>by$ then nm=0
  91. 900 if fl=1 and nm=0 then d=16:goto990
  92. 910 if d=len(rp$)-1 then d=16:goto990
  93. 920 by$(d)=by$
  94. 930 if fl<>3 then goto990
  95. 940 nm=0
  96. 950 if c=0 then l1$=l1$+by$:gosub1590
  97. 960 if c=1 then l3$=l3$+by$:gosub1590
  98. 970 if c=0 or c=8 then l2$=l2$+by$:gosub1590
  99. 980 if fl=3 then d=16
  100. 990 nextd
  101. 1000 if fl=1 or fl=3 then goto1090
  102. 1010 ford=0to15-len(rp$):nm=1
  103. 1020 if by$(d)<>cm$(1) then goto 1070
  104. 1030 fork=1tolen(rp$)-1
  105. 1040 if by$(d+k)<>cm$(k+1) then nm=0
  106. 1050 next
  107. 1060 if nm=1 then d=16:goto1080
  108. 1070 if d=15-len(rp$) then nm=0
  109. 1080 next
  110. 1090 if nm=1 then c=9
  111. 1100 next
  112. 1110 if nm=1 then goto1220
  113. 1120 s=s+1:gosub1150
  114. 1130 if t>et then goto1290
  115. 1140 goto610
  116. 1150 if sf=0 then sl=12:goto1200
  117. 1160 if t<18 then sl=20:goto1200
  118. 1170 if t<25 then sl=18:goto1200
  119. 1180 if t<31 then sl=17:goto1200
  120. 1190 if t<35 then sl=16
  121. 1200 if s>sl then s=0:t=t+1:l1$="":l2$="":l3$=""
  122. 1210 return
  123. 1220 print rp$" found -"
  124. 1230 print"track, sector:";t;s
  125. 1240 print"more rpg codebusting? (y or n)"
  126. 1250 geta$:if a$="" then goto1250
  127. 1260 close 15,8,15:close 2,8,2
  128. 1270 if a$="y" then goto 60
  129. 1280 end
  130. 1290 print rp$;" not yet found..."
  131. 1300 close 15,8,15:close 2,8,2
  132. 1310 goto 60
  133. 1320 ford=0to7:by$(d)="0":next
  134. 1330 print "no commas, please..."
  135. 1340 input"character stat";cs
  136. 1350 if cs>268435456 then print"figure too large for routine":return
  137. 1360 if cs=268435456 then by$(6)="1":goto1500
  138. 1370 if cs=16777216 then by$(7)="1":goto1500
  139. 1380 if cs>16777216 then dv=16777216:d=7:gosub1550
  140. 1390 if cs=1048576 then by$(4)="1":goto1500
  141. 1400 if cs>1048576 then dv=1048576:d=4:gosub 1550
  142. 1410 if cs=65536 then by$(5)="1":goto1500
  143. 1420 if cs>65536 then dv=65536:d=5:gosub 1550
  144. 1430 if cs=4096 then by$(2)="1":goto1500
  145. 1440 if cs>4096 then dv=4096:d=2:gosub1550
  146. 1450 if cs=256 then by$(3)="1":goto1500
  147. 1460 if cs>256 then dv=256:d=3:gosub1550
  148. 1470 if cs=16 then by$(0)="1":goto1500
  149. 1480 if cs>16 then dv=16:d=0:gosub1550
  150. 1490 by$(1)=mid$(hx$,cs+1,1)
  151. 1500 by$(0)=by$(0)+by$(1):by$(1)=by$(2)+by$(3)
  152. 1510 by$(2)=by$(4)+by$(5):by$(3)=by$(6)+by$(7)
  153. 1520 print"probable form of coded stat in block:"
  154. 1530 print by$(0),by$(1),by$(2),by$(3)
  155. 1540 return
  156. 1550 q=cs/dv:q=int(q)
  157. 1560 by$(d)=mid$(hx$,q+1,1)
  158. 1570 cs=cs-dv*q
  159. 1580 return
  160. 1590 if l1$=i$ then nm=1
  161. 1600 if l2$=i$ then nm=1
  162. 1610 if l3$=i$ then nm=1
  163. 1620 if nm=1 then c=9:return
  164. 1630 if len(l1$)=len(i$) then t$=l1$:goto1670
  165. 1640 if len(l2$)=len(i$) then t$=l2$:goto1670
  166. 1650 if len(l3$)=len(i$) then t$=l3$:goto1670
  167. 1660 goto1740
  168. 1670 fork=3tolen(t$)-1step2:w=len(t$)-(k-1):t2$=right$(t$,w):v=len(t2$)
  169. 1680 if t2$=mid$(i$,1,v)thenk=len(t$)
  170. 1690 next
  171. 1700 if mid$(t2$,1,2)<>mid$(i$,1,2) then t2$=""
  172. 1710 if len(l1$)=len(i$) then l1$=t2$:goto1740
  173. 1720 if len(l2$)=len(i$) then l2$=t2$:goto1740
  174. 1730 if len(l3$)=len(i$) then l3$=t2$
  175. 1740 return
  176.